package com.tmpt.controller.springmvc.handlers;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

/**
 * Created by wxy on 2017/10/17.
 */

@Controller //这样标识后HelloWorld成为控制器，在springmvc叫做handler处理器或请求处理器
@RequestMapping("/springmvc")
public class HelloWorld {

    @RequestMapping(value = "/helloworld")
    public void hello(String name,PrintWriter pw) {
        pw.write("hello,"+name);


        /*//.out.println("HelloWorld");
        return "success";*/
    }
    @RequestMapping(value = "/hello1",method = RequestMethod.POST)
    public void hello(@RequestBody List<Map<String,Object>> users,PrintWriter pw) {
        pw.write("hello,"+users.size());
    }
}